survey$hhsize <- NA
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
glimpse(survey$educ)
survey$income <- survey$F10
survey$age <- survey$F2
survey$race <- survey$F11
survey$party <- survey$F6
survey$ideology <- survey$F9
survey$gender <- NA
survey$religion <- survey$F5
survey_822102 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
View(survey_822102)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
setwd("/Users/reneelouis/Dropbox (Tapcats)/Perception_Inequality_wHannah/Survey Files/Harris 1982 Omnibus State of the Union Address Survey, study no. 822102")
library(dplyr)
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s822102_spss.tab", header = TRUE)
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 822102
# study year (year)
survey$year <- 1982
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
#                          'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#                              South=c("South_(3)", "South_(4)"),
#                              West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
# survey$hh <- as.factor(car::recode(survey$F9A, "c(1, 3) = 'Yes'; 2 = 'No'; 4 = 'Not sure'; else = NA"))
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 0 = 'No'; else = NA"))
# union (union.other)
survey$union.other <- as.factor(car::recode(survey$F4_2, "1 = 'Yes'; 0 = 'No'; else = NA"))
# employment (employed)
# survey$employed <- survey$F10A
survey$employed <- NA
# occupation
survey$occupation <- survey$F1
# household size (hhsize)
# survey$hhsize <- survey$F11A
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F10
# age
survey$age <- survey$F2
# race
survey$race <- survey$F11
# politics (party)
survey$party <- survey$F6
# politics (ideology)
survey$ideology <- survey$F9
# gender
# survey$gender <- survey$F15
survey$gender <- NA
# religion
survey$religion <- survey$F5
# subset
survey_822102 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
# save file
saveRDS(survey_822102, file = "survey_822102.rds")
View(survey_822102)
setwd("/Users/reneelouis/Dropbox (Tapcats)/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(dplyr)
library(tidyr)
library(car)
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
View(survey)
survey$pid <- c(1:nrow(survey))
survey$study <- 832101
survey$year <- 1983
survey$urban <- NA
survey$region <- NA
survey$hh <- NA
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
survey$inequality.variable <- 1
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 0 = 'No'; else = NA"))
survey$union.other <- as.factor(car::recode(survey$F4_2, "1 = 'Yes'; 0 = 'No'; else = NA"))
survey$employed <- NA
survey$occupation <- survey$F1
survey$hhsize <- NA
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
glimpse(survey$educ)
survey$income <- survey$F10
survey$age <- survey$F2
survey$race <- survey$F14
survey$party <- survey$F7
survey$ideology <- survey$F9
survey$gender <- NA
survey$religion <- survey$F5
survey_832101 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
View(survey_832101)
summary(survey$F4)
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
survey$union.other <- as.factor(car::recode(survey$F4_2, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
setwd("/Users/reneelouis/Dropbox (Tapcats)/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(dplyr)
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 832101
# study year (year)
survey$year <- 1983
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
#                          'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#                              South=c("South_(3)", "South_(4)"),
#                              West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
# survey$hh <- as.factor(car::recode(survey$F9A, "c(1, 3) = 'Yes'; 2 = 'No'; 4 = 'Not sure'; else = NA"))
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# union (union.other)
survey$union.other <- as.factor(car::recode(survey$F4_2, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# employment (employed)
# survey$employed <- survey$F10A
survey$employed <- NA
# occupation
survey$occupation <- survey$F1
# household size (hhsize)
# survey$hhsize <- survey$F11A
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F10
# age
survey$age <- survey$F2
# race
survey$race <- survey$F14
# politics (party)
survey$party <- survey$F7
# politics (ideology)
survey$ideology <- survey$F9
# gender
# survey$gender <- survey$F15
survey$gender <- NA
# religion
survey$religion <- survey$F5
# subset
survey_832101 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
# save file
saveRDS(survey_802125, file = "survey_802125.rds")
setwd("/Users/reneelouis/Dropbox (Tapcats)/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(dplyr)
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 832101
# study year (year)
survey$year <- 1983
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
#                          'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#                              South=c("South_(3)", "South_(4)"),
#                              West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
# survey$hh <- as.factor(car::recode(survey$F9A, "c(1, 3) = 'Yes'; 2 = 'No'; 4 = 'Not sure'; else = NA"))
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# union (union.other)
survey$union.other <- as.factor(car::recode(survey$F4_2, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# employment (employed)
# survey$employed <- survey$F10A
survey$employed <- NA
# occupation
survey$occupation <- survey$F1
# household size (hhsize)
# survey$hhsize <- survey$F11A
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F10
# age
survey$age <- survey$F2
# race
survey$race <- survey$F14
# politics (party)
survey$party <- survey$F7
# politics (ideology)
survey$ideology <- survey$F9
# gender
# survey$gender <- survey$F15
survey$gender <- NA
# religion
survey$religion <- survey$F5
# subset
survey_832101 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
# save file
saveRDS(survey_832101, file = "survey_832101.rds")
View(survey_832101)
survey$union.self <- as.factor(car::recode(survey$F4_1, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
summary(survey$union.self)
summary(survey$F4)
survey$union.self <- as.factor(car::recode(survey$F4, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
survey$union.other <- as.factor(car::recode(survey$F4, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
summary(survey$union.other)
summary(survey$union.self)
setwd("/Users/reneelouis/Dropbox (Tapcats)/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(dplyr)
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 832101
# study year (year)
survey$year <- 1983
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
#                          'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#                              South=c("South_(3)", "South_(4)"),
#                              West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
# survey$hh <- as.factor(car::recode(survey$F9A, "c(1, 3) = 'Yes'; 2 = 'No'; 4 = 'Not sure'; else = NA"))
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.factor(car::recode(survey$F4, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# union (union.other)
survey$union.other <- as.factor(car::recode(survey$F4, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# employment (employed)
# survey$employed <- survey$F10A
survey$employed <- NA
# occupation
survey$occupation <- survey$F1
# household size (hhsize)
# survey$hhsize <- survey$F11A
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F10
# age
survey$age <- survey$F2
# race
survey$race <- survey$F14
# politics (party)
survey$party <- survey$F7
# politics (ideology)
survey$ideology <- survey$F9
# gender
# survey$gender <- survey$F15
survey$gender <- NA
# religion
survey$religion <- survey$F5
# subset
survey_832101 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
# save file
saveRDS(survey_832101, file = "survey_832101.rds")
View(survey_832101)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
summary(survey$F4)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1983 Omnibus Ronald Reagan's Presidency Survey, study no. 832101")
library(tidyr)
library(car)
# loading data
survey <- read.table("harris_s832101_spss.tab", header = TRUE)
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 832101
# study year (year)
survey$year <- 1983
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
#                          'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#                              South=c("South_(3)", "South_(4)"),
#                              West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
# survey$hh <- as.factor(car::recode(survey$F9A, "c(1, 3) = 'Yes'; 2 = 'No'; 4 = 'Not sure'; else = NA"))
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- as.factor(car::recode(survey$Q5_2, "1 = 'Feel'; 2 = 'Don t feel'; 3 = 'Not sure'; else = NA"))
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.factor(car::recode(survey$F4, "1 = 'Yes'; 2 = 'No'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# union (union.other)
survey$union.other <- as.factor(car::recode(survey$F4, "1 = 'No'; 2 = 'Yes'; 3 = 'No'; 4 = 'Not sure'; else = NA"))
# employment (employed)
# survey$employed <- survey$F10A
survey$employed <- NA
# occupation
survey$occupation <- factor(dplyr::recode(survey$F1,
`1` = "Professional",
`2` = "Manager, official",
`3` = "Proprietor (small business)",
`4` = "Clerical worker",
`5` = "Sales worker",
`6` = "Skilled craftsman, foreman",
`7` = "Operative, unskilled laborer (except farm)",
`8` = "Service worker",
`9` = "Farmer, farm manager, farm laborer",
`10` = "Student",
`11` = "Housewife",
`12` = "Military service",
`13` = "Unemployed",
`14` = "Retired",
`15` = "Welfare",
`16` = "Disabled",
`17` = "Other (SPECIFY)",
`18` = "Not sure/refused"))
summary(survey$occupation)
# household size (hhsize)
# survey$hhsize <- survey$F11A
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F3, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7, 10) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- factor(dplyr::recode(survey$F10,
`1` = "$7,500 or less",
`2` = "$7,501 to $15,000",
`3` = "$15,001 to $25,000",
`4` = "$25,001 to $35,000",
`5` = "$35,001 to $50,000",
`6` = "$50,001 or over",
`7` = "Not sure/no answer/refused"))
# age
survey$age <- factor(dplyr::recode(survey$F2,
`1` = "18-20",
`2` = "21-24",
`3` = "25-29",
`4` = "30-34",
`5` = "35-39",
`6` = "40-49",
`7` = "50-64",
`8` = "65 and over",
`9` = "Refused"))
summary(survey$age)
# race
survey$race <- factor(dplyr::recode(survey$F14,
`1` = "White",
`2` = "Black",
`3` = "Oriental/Asian or Pacific Islander",
`4` = "American Indian or Alaskan native",
`5` = "Not sure"))
summary(survey$race)
# politics (party)
survey$party <- factor(dplyr::recode(survey$F7,
`1` = "Republican",
`2` = "Democrat",
`3` = "Independent",
`4` = "Other",
`5` = "Not sure"))
summary(survey$party)
# politics (ideology)
survey$ideology <- factor(dplyr::recode(survey$F9,
`1` = "Conservative",
`2` = "Middle-of-the-road",
`3` = "Liberal",
`4` = "Not sure"))
summary(survey$ideology)
# gender
# survey$gender <- survey$F15
summary(survey$S1)
survey$gender <- factor(dplyr::recode(survey$S1,
`1` = "Male",
`2` = "Female"))
summary(survey$gender)
# religion
survey$religion <- factor(dplyr::recode(survey$F5,
`1` = "Protestant",
`2` = "Catholic",
`3` = "Jewish",
`4` = "Other (SPECIFY)",
`5` = "None (vol.)",
`6` = "Not sure"))
summary(survey$religion)
# subset
survey_832101 <- survey[ ,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_832101)
saveRDS(survey_832101, file = "survey_832101.rds")
